﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Payment_view.aspx.cs" Inherits="Main_Accounts_VoucherDisplay_Payment_view"
    Culture="en-GB" %>

<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="CalendarExtenderPlus" Namespace="AjaxControlToolkitPlus" TagPrefix="advancedCalender" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Payment View</title>
    <link href="../../../Styles/accounts.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        function checkDate() {
            var fromDate = document.getElementById("txtfrom");
            var toDate = document.getElementById("txtto");

            var arrFrom = fromDate.value.split("/");
            var fromDate1 = arrFrom[1] + '/' + arrFrom[0] + '/' + arrFrom[2];
            var arrTo = toDate.value.split("/");
            var toDate1 = arrTo[1] + '/' + arrTo[0] + '/' + arrTo[2];

            var mainFromDate = new Date(fromDate1);
            var mainToDate = new Date(toDate1);
            if (mainFromDate > mainToDate) {
                alert('Start Date Should Be Less Than');
                return false;
            }
            else {
                return true;
            }
        }
        function go(key, from, to, transactiontype) {
            window.open('../VoucherPrint/Voucher_Print.aspx?key=' + key + '&from=' + from + '&to=' + to + '&transactiontype=' + transactiontype);
        }
        function EnabledTabKey(id, e) {
            var keycode;
            if (window.event) {
                keycode = window.event.keyCode;
            }
            else if (e) {
                keycode = e.which;
            }
            else {
                return true;
            }

            if (keycode == 9) {
                // if is the tab key                
                return true;
            }
            else {
                return false;
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div style="width: 90%; margin-left: 5%; margin-right: 5%;">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div style="margin-left: 5%; margin-right: 5%; width: 90%" align="center">
                    <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
                </div>
                <div class="divmain">
                    <acc:heading ID="pagehead" runat="server" HeadingText="Payment Detail's" />
                </div>
                <table>
                    <tr>
                        <td>
                            <b>From:</b>
                        </td>
                        <td>
                            <asp:TextBox ID="txtfrom" runat="server" onkeydown="return EnabledTabKey(this.id, event);"
                                CssClass="input" ValidationGroup="Payment" />
                            <asp:ImageButton ID="imgfrmdate" runat="server" ImageUrl="~/Images/calendar.gif" />
                            <advancedCalender:CalendarExtenderPlus ID="CalFrom" runat="server" PopupButtonID="imgfrmdate"
                                Format="dd/MM/yyyy" TargetControlID="txtfrom">
                            </advancedCalender:CalendarExtenderPlus>
                            <asp:RequiredFieldValidator ID="reqFromDate" runat="server" ControlToValidate="txtfrom"
                                ErrorMessage="*" ValidationGroup="Payment"></asp:RequiredFieldValidator>
                            <%--<asp:TextBox ID="txtfrom" runat="server"/>
                        <asp:ImageButton ID="imgfrmdate" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <asp:RequiredFieldValidator ID="reqFromDate" runat="server" 
                          ControlToValidate="txtfrom" ErrorMessage="*" ValidationGroup="Payment"></asp:RequiredFieldValidator>
                        <ajaxToolkit:CalendarExtender ID="claFromDate" runat="server"  TargetControlID ="txtfrom" PopupButtonID="imgfrmdate" Format="dd/MM/yyyy" Enabled="True" ></ajaxToolkit:CalendarExtender> 
                        <ajaxToolkit:MaskedEditExtender ID="maskFromDate" runat="server"  CultureName="en-GB"  TargetControlID="txtfrom"
                            Mask="99/99/9999" MaskType="Date"></ajaxToolkit:MaskedEditExtender>
                        <ajaxToolkit:MaskedEditValidator ID="valFromDate" runat="server" ControlExtender="maskFromDate"
                            ControlToValidate="txtfrom" InvalidValueMessage="Invalid Date" TooltipMessage="Invalid Date"></ajaxToolkit:MaskedEditValidator>--%>
                        </td>
                        <td>
                            <b>To:</b>
                        </td>
                        <td>
                            <asp:TextBox ID="txtto" runat="server" onkeydown="return EnabledTabKey(this.id, event);"
                                CssClass="input" ValidationGroup="Payment" />
                            <asp:ImageButton ID="Imageto" runat="server" ImageUrl="~/Images/calendar.gif" />
                            <advancedCalender:CalendarExtenderPlus ID="CalendarExtenderPlus1" runat="server"
                                PopupButtonID="Imageto" Format="dd/MM/yyyy" TargetControlID="txtto">
                            </advancedCalender:CalendarExtenderPlus>
                            <asp:RequiredFieldValidator ID="reqToDate" runat="server" ControlToValidate="txtto"
                                ErrorMessage="*" ValidationGroup="Payment"></asp:RequiredFieldValidator>
                            <%--<asp:TextBox ID="txtto" runat="server" />
                    <asp:ImageButton ID="Imageto" runat="server" ImageUrl="~/Images/calendar.gif" />
                    <asp:RequiredFieldValidator ID="reqToDate" runat="server" 
                        ControlToValidate="txtto" ErrorMessage="*" ValidationGroup="Payment"></asp:RequiredFieldValidator>
                    <ajaxToolkit:CalendarExtender ID="calToDate" runat="server"  TargetControlID ="txtto"  PopupButtonID="Imageto" Format="dd/MM/yyyy" Enabled="True" ></ajaxToolkit:CalendarExtender>
                    <ajaxToolkit:MaskedEditExtender ID="maskToDate" CultureName="en-GB" runat="server" TargetControlID="txtto"
                        Mask="99/99/9999" MaskType="Date"></ajaxToolkit:MaskedEditExtender>
                    <ajaxToolkit:MaskedEditValidator ID="valToDate" runat="server"  ControlExtender="maskToDate"
                        ControlToValidate="txtto" InvalidValueMessage="Invalid Date" TooltipMessage="Invalid Date"></ajaxToolkit:MaskedEditValidator>--%>
                        </td>
                        <td>
                            <asp:Button ID="btnSearch_period" runat="server" Text="View" CssClass="button" OnClientClick="return checkDate();"
                                OnClick="btnSearch_period_Click" ValidationGroup="Payment" />
                        </td>
                    </tr>
                </table>
                <div style="width: 100%; height: 10px">
                    &nbsp;</div>
                <asp:DataList ID="dtlPayment" runat="server" Width="95%" OnItemDataBound="dtlPayment_ItemDataBound">
                    <ItemTemplate>
                        <table width="100%" cellspacing="0" style="border-bottom: solid 1px #818181; border-left: solid 1px #818181;
                            border-right: solid 1px #818181;">
                            <tr>
                                <td colspan="2" style="background-color: #818181; color: White;">
                                    <div style="float: left; padding-left: 10px">
                                        <b>Voucher No: </b>&nbsp;<asp:Literal ID="ltrvoucherno" runat="server" Text='<%#Eval("TransactionNumber") %>' />
                                        <asp:HiddenField ID="hidTranId" runat="server" Value='<%#Eval("TransactionId") %>' />
                                    </div>
                                    <div style="float: right; padding-right: 10px">
                                        <b>Date : </b>&nbsp;<%#string.Format("{0:dd-MMM-yyyy}", Eval("TransactionDate"))%><asp:HyperLink
                                            ID="hyp_print" NavigateUrl="#" runat="server"><img src="../../../Images/print.png" /></asp:HyperLink>&nbsp;
                                            <asp:HyperLink ID="hyperEdit" runat="server"><img src="../../../Menu/images/Edit_user.png" alt="Edit This Voucher" /></asp:HyperLink>
                                            </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="padding: 0px 10px 0px 10px; width: 100%;">
                                    <asp:GridView ID="gridPayment" runat="server" DataKeyNames="TransactionSerial" AutoGenerateColumns="false"
                                        OnRowDataBound="gridPayment_RowDataBound" Width="100%" ShowFooter="true">
                                        <Columns>
                                            <asp:TemplateField HeaderText="S. No.">
                                                <ItemTemplate>
                                                    <%# Container.DataItemIndex+1 %>
                                                </ItemTemplate>
                                                <ItemStyle HorizontalAlign="Center" Width="55px" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Dr/Cr" HeaderStyle-HorizontalAlign="Left">
                                                <ItemTemplate>
                                                    <asp:Literal ID="ltrdr_cr" runat="server"></asp:Literal>
                                                </ItemTemplate>
                                                <ItemStyle Width="75px" />
                                            </asp:TemplateField>
                                            <asp:BoundField HeaderText="Particulars" DataField="particulars" FooterText="Total">
                                                <FooterStyle Font-Bold="True" HorizontalAlign="Right" />
                                                <ItemStyle Width="50%" />
                                            </asp:BoundField>
                                            <asp:TemplateField HeaderText="Debit">
                                                <ItemTemplate>
                                                    <p style="text-align: right">
                                                        <asp:Literal ID="ltrdebit" runat="server" Text='<%#Eval("Debit") %>'></asp:Literal></p>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:Literal ID="ltrtotdr" runat="server"></asp:Literal>
                                                </FooterTemplate>
                                                <FooterStyle Font-Bold="true" />
                                                <ItemStyle HorizontalAlign="Right" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Credit">
                                                <ItemTemplate>
                                                    <asp:Literal ID="ltrcredit" runat="server" Text='<%#Eval("Credit") %>'></asp:Literal>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <asp:Literal ID="ltrtotcr" runat="server"></asp:Literal>
                                                </FooterTemplate>
                                                <FooterStyle Font-Bold="true" />
                                                <ItemStyle HorizontalAlign="Right" />
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </td>
                            </tr>
                            <tr>
                                <td valign="top" style="padding-left: 10px; width: 30%">
                                    <asp:Literal ID="ltrcheque_name" runat="server" Text="Cheque No:  " />
                                    <asp:Literal ID="ltrcheque_no" runat="server" Text='<%#Eval("ChequeNumber") %>'></asp:Literal>
                                </td>
                                <td valign="top" style="width: 70%; padding-right: 10px">
                                    <asp:Literal ID="ltrnarration_name" runat="server" Text="Narration: " />
                                    <asp:Literal ID="ltrnarration" runat="server" Text='<%#Eval("Narration") %>'></asp:Literal>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:DataList>
                <div id="divMessage" runat="server" style="width: 95%; text-align: center; border: solid 1px #818181;
                    height: 40px; vertical-align: middle;">
                    <asp:Label ID="lbl_noRecord" runat="server" ForeColor="Red" Text="No Record found in this period  !!!"></asp:Label>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
